FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:1.22.1 AS builder

LABEL stage=suning

ENV CGO_ENABLED=0
ENV GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=on

RUN mkdir /app

WORKDIR /app

COPY ./ ./

ENV GOPROXY https://goproxy.cn,direct

RUN go mod tidy

RUN go build main.go

FROM registry.cn-hangzhou.aliyuncs.com/sn-pub/golang:centos7.9
ENV TZ=Asia/Shanghai

WORKDIR /app

FROM scratch

COPY --from=builder /app/main ./main
COPY --from=builder /app/config.yaml ./config.yaml


CMD ["./main"]
